home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / performSetPrefAngle.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  4.4 KB  |  183 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  Jan. 30, 1997
  22. //
  23. //  Description:
  24. //      This script is for setting prefAngle(a joint command executed).
  25. //
  26. //  Input Arguments:
  27. //      string showOptionBox    true - show the option box dialog
  28. //                              false - just execute the command
  29. //
  30. //  Return Value:
  31. //      None.
  32. //
  33.  
  34. if ( !`exists prefAngleSetOptionVars` ) {
  35.     source prefAngleTabBasic;
  36. }
  37.  
  38. global proc prefAngleSetCallback( string $parent, int $doIt )
  39. {
  40.     setParent $parent;
  41.  
  42.     // Set the optionVar's from the control values, and then perform command
  43.     //
  44.     optionVar -intValue recursive
  45.         (`radioButtonGrp -q -sl recursive` - 1);
  46.  
  47.     if( $doIt ) {
  48.         performSetPrefAngle false; 
  49.         addToRecentCommandQueue "performSetPrefAngle false" "SetPrefAngle";
  50.     }
  51. }
  52.  
  53. proc setPrefAngleOptions()
  54. {
  55.     string $cmdName = "joint";
  56.     string $funcName = "prefAngle";
  57.     string $callback = ($funcName + "SetCallback");
  58.     string $setup = ($funcName + "Setup");
  59.  
  60.     //  Get the option box.
  61.     //
  62.     string $layout = getOptionBox();
  63.  
  64.     // call prefAngleTabBasic to build UI.
  65.     //
  66.     string $parent = `prefAngleTabBasic $layout`;
  67.  
  68.     //  Pass the command name to the option box.
  69.     //
  70.     setOptionBoxCommandName($cmdName);
  71.  
  72.     //  'Apply' button.
  73.     //
  74.     string $buttonW = getOptionBoxApplyBtn();
  75.     button -e -l "Set"
  76.         -command ($callback + " " + $parent + " " + 1)
  77.         $buttonW;
  78.  
  79.     //  'Save' button.
  80.     //
  81.     $buttonW = getOptionBoxSaveBtn();
  82.     button -e
  83.         -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox")
  84.         $buttonW;
  85.  
  86.     //  'Reset' button.
  87.     //
  88.     $buttonW = getOptionBoxResetBtn();
  89.     button -e
  90.         -command ($setup + " " + $parent + " " + 1)
  91.         $buttonW;
  92.  
  93.     //  Set the option box title.
  94.     //
  95.     setOptionBoxTitle("Set Preferred Angle Options");
  96.  
  97.     //    Customize the 'Help' menu item text.
  98.     //
  99.     setOptionBoxHelpTag( "SetPreferredAngle" );
  100.  
  101.     // Call the setup "method" to fill in the current settings
  102.     //
  103.     eval( ($setup + " " + $parent + " " + 0) );
  104.  
  105.     //  Show the option box.
  106.     //
  107.     showOptionBox();
  108. }
  109.  
  110. proc string setPrefAngleHelp()
  111. {
  112.     return "  Command: set joints preferred angle.\n";
  113. }
  114.  
  115. proc string assembleCmd()
  116. {
  117.     prefAngleSetOptionVars( false );
  118.  
  119.     int $isRecursive = `optionVar -q recursive`;
  120.  
  121.     // execute a joint cmd to set prefAngle.
  122.     // $cmdString is for journaling.
  123.     //
  124.     string $cmdString;
  125.     if ( $isRecursive )
  126.         $cmdString = "joint -e -spa -ch";
  127.     else
  128.         $cmdString = "joint -e -spa";
  129.  
  130.     return $cmdString;
  131. }
  132.  
  133. //
  134. //    Procedure Name:
  135. //        performSetPrefAngle
  136. //
  137. //    Description:
  138. //        Perform the joint command to set joints' preferred angle using the
  139. //        corresponding option values. This procedure will also show the option
  140. //        box window if necessary as well as construct the command string that
  141. //        will invoke the joint command with the current option box values.
  142. //
  143. //    Input Arguments:
  144. //        0 - Execute the command.
  145. //        1 - Show the option box dialog.
  146. //        2 - Return the command.
  147. //
  148. global proc string performSetPrefAngle(int $action )
  149. {
  150.     string $cmd = "";
  151.  
  152.     switch( $action )
  153.     {
  154.         //  Execute the command.
  155.         //
  156.         case 0:
  157.             // Retrieve the option settings
  158.             //
  159.             prefAngleSetOptionVars( false );
  160.  
  161.             $cmd = `assembleCmd`;
  162.             evalEcho($cmd);
  163.             break;
  164.  
  165.         // Show the option box.
  166.         //
  167.         case 1:
  168.             setPrefAngleOptions;
  169.             break;
  170.  
  171.         // Return the command string.
  172.         //
  173.         case 2:
  174.             //  Retrieve the option settings.
  175.             //
  176.             prefAngleSetOptionVars( false );
  177.  
  178.             $cmd = `assembleCmd`;
  179.             break;
  180.     }
  181.     return $cmd;
  182. }
  183.